package com.qf.domain;

import java.util.List;

/**
 * @author YDW
 * projectName:shopping
 * time:2022/4/19 17:36
 * description:
 */
public class PageBean {
    //当前页码 前端提供
    private int pageNum;
    //总条数  数据库查询
    private Long totalCount;
    //每页显示条数  前端提供，没有默认
    private int pageSize;
    //总页数 计算
    private int totalPage;
    //要展示的数据   数据库查询
    private List data;
    //起始页
    private int startPage=1;
    //末页
    private int endPage;
    //分类id
    private int typeId;

    public PageBean() {
    }

    public PageBean(int pageNum, Long totalCount, int pageSize, List data) {
        this.pageNum = pageNum;
        this.totalCount = totalCount;
        this.pageSize = pageSize;
        this.data = data;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public Long getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Long totalCount) {
        this.totalCount = totalCount;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotalPage() {
         this.totalPage= (int) Math.ceil(totalCount * 1.0 / pageSize);
        return totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }

    public List getData() {
        return data;
    }

    public void setData(List data) {
        this.data = data;
    }

    public int getStartPage() {
        return startPage;
    }

    public void setStartPage(int startPage) {
        this.startPage = startPage;
    }

    public int getEndPage() {
        this.endPage= (int) Math.ceil(totalCount * 1.0 / pageSize);
        return endPage;
    }

    public void setEndPage(int endPage) {
        this.endPage = endPage;
    }

    public int getTypeId() {
        return typeId;
    }

    public void setTypeId(int typeId) {
        this.typeId = typeId;
    }
}
